#doc----------------------------------------------------------------
#一个建议：所有特殊箭矢应有一个特殊尾迹
#所有参数 显示格式为NBT路径(NBT路径以宏参数内的register为根目录)
#String(Text Component) | name: 箭矢名称(默认为注册id)
#String(Path) | item_modifier: 生成时调用的物品修饰器
#String | spawn: 在生成时运行
#String | tick: 在每tick运行
#String | flying: 在每tick运行(条件: inGround:false)
#String | hit: 击中方块运行
#String | hit_entity: 击中实体运行
#String | victim: 受害者运行
#String | item_model: 箭矢物品作为独立物品时的模型
#int | arrow_bundle_model_data: 箭矢存于箭袋时箭袋的custom_model_data，用于展示当前箭矢
#doc----------------------------------------------------------------

#格式检查
execute if data storage dab:register parser.name run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.name"}
execute if data storage dab:register parser.item_modifier run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.item_modifier"}
execute if data storage dab:register parser.spawn run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.spawn"}
execute if data storage dab:register parser.tick run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.tick"}
execute if data storage dab:register parser.flying run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.flying"}
execute if data storage dab:register parser.hit run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.hit"}
execute if data storage dab:register parser.hit_entity run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.hit_entity"}
execute if data storage dab:register parser.victim run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.victim"}
execute if data storage dab:register parser.item_model run function dab:system/register/format_check {type:"string",path:"from storage dab:register parser.item_model"}
execute if data storage dab:register parser.arrow_bundle_model_data run function dab:system/register/format_check {type:"int",path:"from storage dab:register parser.arrow_bundle_model_data"}
execute unless data storage dab:register parser run return fail

#默认
execute unless data storage dab:register parser.name run data modify storage dab:register parser.name set from storage dab:register parser.id
execute unless data storage dab:register parser.arrow_bundle_model_data run data modify storage dab:register parser.arrow_bundle_model_data set value 1
execute unless data storage dab:register parser.item_model run data modify storage dab:register parser.item_model set value "minecraft:arrow"

#删除冗余键
function dab:system/register/.redundant_key_killer/start {protections:["item_modifier","name","spawn","tick","flying","hit","hit_entity","victim","item_model","arrow_bundle_model_data"]}